package org.example.http;

import java.io.IOException;

public abstract class NServlet {
    public void service(NRequest request, NResponse response) throws IOException {
        if ("GET".equalsIgnoreCase(request.getMethod())) {
            doGet(request, response);
        } else {
            doPost(request, response);
        }
    }

    protected abstract void doGet(NRequest request, NResponse response) throws IOException;

    protected abstract void doPost(NRequest request, NResponse response) throws IOException;
}
